package com.jn.zhinongbao.adapter.bean;

public class User {
    private int id;
    private String username;
    private String password;
    private String phone;
    private int role; // 0: 商家, 1: 用户
    private String shopName; // 店铺名称，仅商家使用

    public User() {}

    public User(String username, String password, String phone, int role) {
        this.username = username;
        this.password = password;
        this.phone = phone;
        this.role = role;
    }

    public User(String username, String password, String phone, int role, String shopName) {
        this.username = username;
        this.password = password;
        this.phone = phone;
        this.role = role;
        this.shopName = shopName;
    }

    // Getters and Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getRole() {
        return role;
    }

    public void setRole(int role) {
        this.role = role;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public boolean isMerchant() {
        return role == 0;
    }

    public boolean isUser() {
        return role == 1;
    }

    public String getRoleText() {
        return role == 0 ? "商家" : "用户";
    }
} 